import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/layout'
  },
  // 移动端路由
  {
    path: '/layout',
    name: 'layout',
    component: () => import('@/views/mobile/layout/LayoutView.vue'),
    children: [
      {
        path: '',
        redirect: '/home'
      },
      {
        path: '/home',
        name: 'home',
        component: () => import('@/views/mobile/layout/HomeView.vue')
      },
      {
        path: '/sign',
        name: 'sign',
        component: () => import('@/views/mobile/sign/SignView.vue')
      },
      {
        path: '/my',
        name: 'my',
        component: () => import('@/views/mobile/my/MyView.vue')
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('@/views/mobile/login/LoginView.vue')
  },
  {
    path: '/forget',
    name: 'forget',
    component: () => import('@/views/mobile/login/ForgetPwdView.vue')
  },
  {
    path: '/setting',
    name: 'setting',
    component: () => import('@/views/mobile/my/setting/SettingView.vue')
  },
  {
    path: '/setting/userInfo',
    name: 'userInfo',
    component: () => import('@/views/mobile/my/setting/UserInfoView.vue')
  },
  {
    path: '/setting/about',
    name: 'about',
    component: () => import('@/views/mobile/my/setting/AboutView.vue')
  },
  {
    path: '/setting/updatePwd',
    name: 'updatePwd',
    component: () => import('@/views/mobile/my/setting/UpdatePwdView.vue')
  },
  {
    path: '/setting/version',
    name: 'version',
    component: () => import('@/views/mobile/my/setting/VersionView.vue')
  },
  {
    path: '/setting/feedback',
    name: 'feedback',
    component: () => import('@/views/mobile/my/setting/FeedbackView.vue')
  },
  {
    path: '/setting/feedbackDetail/:id',
    name: 'feedbackDetail',
    component: () => import('@/views/mobile/my/setting/FeedbackDetailView.vue')
  },

  // PC管理端路由
  {
    path: '/admin',
    redirect: '/admin/layout'
  },
  {
    path: '/admin/layout',
    name: 'adminLayout',
    component: () => import('@/views/admin/layout/LayoutView.vue'),
    children: [
      {
        path: '',
        redirect: '/admin/home'
      },
      {
        path: '/admin/home',
        name: 'adminHome',
        component: () => import('@/views/admin/layout/HomeView.vue')
      },
      {
        path: '/admin/version',
        name: 'adminVersion',
        component: () => import('@/views/admin/version/VersionView.vue')
      },
      {
        path: '/admin/incentive',
        name: 'adminIncentive',
        component: () => import('@/views/admin/incentive/IncentiveView.vue')
      },
      {
        path: '/admin/user',
        name: 'adminUser',
        component: () => import('@/views/admin/user/UserView.vue')
      },
      {
        path: '/admin/banner',
        name: 'adminBanner',
        component: () => import('@/views/admin/banner/BannerView.vue')
      },
      {
        path: '/admin/resources',
        name: 'adminResources',
        component: () => import('@/views/admin/resources/ResourcesView.vue')
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
